package com.hourse.platform.common;


import com.hourse.platform.vo.PageData;
import com.hourse.platform.exception.AppException;

import java.io.Serializable;

public enum ErrorMsg implements Serializable {

    SCOPE_ERR(90001, "访问 SCOPE 错误..."),
    AUTH_ERR(90000, "无访问权限..."),
    ACCOUNT_NOT_FOUND(90003, "账号或密码错误..."),
    ACCOUNT_PASSWOR_ERR(90004, "账号或密码错误..."),
    ACCOUNT_STATE_ERR(90004, "账号已被禁用..."),
    ERIFY_VODE_ERR(90004, "图形验证码错误..."),
    BEAN_ERR(90005, "字段格式有误"),
    SYSTEM_ERR(90006, "系统服务异常"),
    PASSWORD_ERR(90007, "密码信息不一致"),
    RESET_PASSWORD_ERR(90009, "密码不能与账号相同..."),
    FILE_NOT_FOUND(90008, "无对应文件或文件路径错误"),
    BEAN_CHECK_ERR(10002, "信息体校验异常..."),
    ACCOUNT_ALREADY_EXISTS(80001, "账号已存在..."),
    WHITELIST_NOT_EXISTS(80002, "手机号未命中白名单..."),
    DB_ERR(10001, "数据操作异常..."),
    TOKEN_TIME_OUT(90007, "登录已超时,请重新登录..."),
    FLOW_FILTER(70000, "流程监控处理异常!");


    private Integer code;
    private String msg;

    ErrorMsg(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public PageData Build() {

        return PageData.ERROR(this);
    }

    public AppException Exception() {

        return new AppException(this.code, this.msg);
    }

    public void ThrowsException() throws AppException {
        throw new AppException(this.code, this.msg);
    }

    public void Ex() throws AppException {
        throw new AppException(this.code, this.msg);
    }


    public Integer code() {
        return this.code;
    }

    public String msg() {
        return this.msg;
    }


}
